package fit.acmetelecom.fakes;

import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.Collection;

import com.acmetelecom.customer.Customer;
import com.acmetelecom.utils.MoneyFormatter;
import com.acmetelecom.utils.Printer;

import fit.acmetelecom.BillRow;

public final class FakeHtmlPrinter implements Printer {
	private final Object lock = new Object();
	private StringBuilder output = new StringBuilder();
	private Collection<BillRow> billRows = new ArrayList<BillRow>();

	public void print(String characters) {
		synchronized (lock) {
			output.append(characters);
		}
	}

	public void printRow(Customer c, String Time, Customer Callee,
			String Duration, BigDecimal cost, BigDecimal total) {
		billRows.add(new BillRow(c.getFullName(), c.getPhoneNumber(), c
				.getPricePlan(), Time, Callee.getPhoneNumber(), Duration, MoneyFormatter.penceToPounds(cost), MoneyFormatter.penceToPounds(total)));
	}

	public Collection<BillRow> getRows() {
		return billRows;
	}

	@Override
	public void printHeading(String name, String phoneNumber, String pricePlan) {
		return;
	}

	@Override
	public void printItem(String time, Customer customer, String duration,
			BigDecimal cost) {
		return;
	}

	@Override
	public void printTotal(BigDecimal total) {
		return;
	}
}
